package com.xl.action;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.xl.bean.BaseModel;
import com.xl.bean.Login;
import com.xl.bean.ModelMapping;
import com.xl.mananger.MappingManager;
import com.xl.mananger.ModelManager;
import com.xl.service.LoginService;
import com.xl.service.impl.LoginServiceImpl;

/**
 * 
 * @author 深圳-夕落  2014-11-25
 * 登陆的Action
 */
public class LoginAction implements Action{

	public String execute(HttpServletRequest request,HttpServletResponse response) 
	{
		Login login = (Login) ModelManager.getModel(request);
		LoginService service = new LoginServiceImpl();
		if(service.login(login)){ 
			request.setAttribute("msg", "登陆成功！欢迎你"+login.getUserName());
			return  "success";
			
		}else  
		{ 
			request.setAttribute("msg", "用户名或者密码错误！");
			return  "error";
		}
		
	}

	

	
}
